7a8466b0229eb359caf0953a638e811ef0281ae9,plugin/src/main/java/org/autorefactor/refactoring/rules/CollectionRefactoring.java,CollectionRefactoring,maybeReplaceSetContains,#MethodInvocation#Statement#Expression#boolean#,408
Before Change
private boolean maybeReplaceSetContains(
MethodInvocation miContains, Statement stmt, Expression toReplace, boolean negate) {
if (isMethod(miContains, "java.util.Set", "contains", "java.lang.Object")) {
Statement firstStmt = getAsList(stmt, 0);
MethodInvocation miAdd = asExpression(firstStmt, MethodInvocation.class);
final ASTMatcher astMatcher = new ASTMatcher();
After Change
private boolean maybeReplaceSetContains(final IfStatement nodeToReplace, final Expression ifExpression,
final Statement statement,
final Statement oppositeStatement, final boolean negate, final String methodName) {
final MethodInvocation miContains = as(ifExpression, MethodInvocation.class);
if (isMethod(miContains, "java.util.Set", "contains", "java.lang.Object") && !asList(statement).isEmpty()) {
final Statement firstStmt = getAsList(statement, 0);
final MethodInvocation miAddOrRemove = asExpression(firstStmt, MethodInvocation.class);
final ASTMatcher astMatcher = new ASTMatcher();